package com.itheima.d5_resource;

import java.io.*;

/*
     目标：掌握释放资源的方式：try-with-resource
 */
public class Test3 {
    public static void main(String[] args)  {
        try(FileInputStream fis = new FileInputStream("D:\\AAA\\壁纸\\wallhaven\\wallhaven-m3zx3m_1920x1080.png");
            FileOutputStream fos = new FileOutputStream("B.png");) {
        byte[] bytes = new byte[1024];
        int byt;
        while ((byt = fis.read(bytes)) != -1) {
            fos.write(bytes, 0, byt);
        }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
